package ru.alt22.visor.php.ui.providers;

import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.php.internal.core.phpModel.phpElementData.PHPClassData;
import org.eclipse.php.internal.core.phpModel.phpElementData.PHPModifier;
import org.eclipse.swt.graphics.Image;

import ru.alt22.visor.php.ui.PluginImages;

public class PHPElementLabelProvider implements ITableLabelProvider {

	private static Image classImage = null;
	private static Image interfaceImage = null;

	public Image getColumnImage(Object element, int columnIndex) {
		if (element instanceof PHPClassData) {
			PHPClassData classData = (PHPClassData) element;
			if (!PHPModifier.isInterface(classData.getModifiers())) {
				if (classImage == null) {
					classImage = PluginImages.DESC_CLASS_INFO.createImage();
				}
				return classImage;
			} else {
				if (interfaceImage == null) {
					interfaceImage = PluginImages.DESC_INTERFACE_INFO.createImage();
				}
				return interfaceImage;
			}
		}
		return null;
	}

	public String getColumnText(Object element, int columnIndex) {
		return element.toString();
	}

	public void addListener(ILabelProviderListener listener) {
	}

	public void dispose() {
	}

	public boolean isLabelProperty(Object element, String property) {
		return false;
	}

	public void removeListener(ILabelProviderListener listener) {
	}

}
